<load file="__PUBLIC__/header.html"/>
<ul class="top_title">
    <li>
        <p class="menu_title">首页图片</p>
    </li>
    <li>|</li>
    <li>
        <a href="__CONTROL__/addIndexImg" class="menu_title_a" >
            <i class="icon icon-plus-sign"></i>&nbsp;添加
        </a>
    </li>
</ul>
<form action="__APP__/index/sort" method="post">
    <table class="table">
        <thead>
            <tr class="top_channel">
                <th align="center" width="60">ID</th>
                <th align="center" width="40">排序</th>
                <th width='20'></th>
                <th align="center" width="26%">图片缩略</th>
                <th align="center" width="150">跳转网站</th>
                <th align="center" width="100">是否使用</th>
                
                <th align="center">操作</th>
            </tr>
        </thead>
        <tbody>
      

        <foreach from="$list" value="$v">
            <tr class="top_channel">
           
                <td align="center">
                    <input type="text" disabled="disabled" value="{$v.id}"  class="input-medium"/>
                </td>
                <td align="center">
                    <input type="text" disabled="disabled" value="{$v.orders}"  class="input-medium" size="5" />
                </td>
                <td width='20'></td>
                <td align="left" class="dis">
                   <a href="__ROOT__/{$v.src}"><img src="__ROOT__/{$v.src}" width="60" alt="{$v.title}"></a>
                </td>
                <td align="center">
                    {$v.url}
                </td>
                <td align="center">
                    <if value="$v.isshow">
                        <span class="btn isshow" id='{$v.id}' style='color:#888'  zt='{$v.isshow}' lid='{$v.id}'>使用</span>
                        <else/>
                        <span class="btn isshow" id='{$v.id}' style='color:#f60'  zt='{$v.isshow}' lid='{$v.id}'>禁止</span>

                    </if>
                </td>


                <td align="center">
                    
                    <a href="__CONTROL__/editIndexImg?id={$v.id}" class="isok btn edit">

                        <i class="icon icon-edit"></i>&nbsp;编辑
                    </a>
                    |
                    <a href="__CONTROL__/editIndexImg?id={$v.id}" class="isok btn del">
                        <i class="icon icon-trash"></i>&nbsp;删除
                    </a>
                </td>
            </tr>
        </foreach>

            <tr class="top_channel">
                <td></td>
                <td align="center">
                    
                </td>
                <td colspan="5"> {$page}</td>
            </tr>
        </tbody>
    </table>
</form>
<script type='text/javascript'>
    $(function(){
        $('.del').click(function(){
            var cn = confirm('确定删除吗？');
            if(!cn){
                return false;
            }
        });
         //内容分类ajax修改使用状态
          $('.isshow').live('click',function (){

            var zt = $(this).attr('zt');
            var id = $(this).attr('lid');
            ajaxChange('indexImgAjax',id,zt);
    
         });


   


   
    });

    function ajaxChange(action,id,zt){
          
             $.post('__CONTROL__/'+action,{'id':id,'zt':zt},function(data){
                

               if(data){//返回真，更新成功，修改前台css显示

                       if(zt=='1'){
                            $('#'+data).css('color','#f60').attr('zt','0').html('禁止');
                        }else{
                          //alert('222');
                           $('#'+data).css('color','#888').attr('zt','1').html('使用');

                       }

               //  history.go(0);
                   //  for(num in data.ids){
                   //     if(zt=='1'){
                   //          $('#'+data.ids[num]['id']).css('color','#f60').attr('zt','0').html('禁止');
                   //      }else{
                   //        //alert('222');
                   //         $('#'+data.ids[num]['id']).css('color','#888').attr('zt','1').html('使用');

                   //     }
                
                   // }
               // history.go(0);
                
               }
            },"json");
        
    }
       // //修改使用状态
       //  function takeChange(data,zt){
       //   alert(data);
       //  }
</script>
</body>

</html>